package Executor;


import interfaces.PrimeFinder;

import java.util.concurrent.ExecutorService;

public class PrimeFinderImpl implements PrimeFinder {

    @Override
    public boolean isPrime(int checkNumber) {
        if (checkNumber <= 1)
            return false;
        if (checkNumber == 2)
            return true;
        double root = Math.sqrt(checkNumber);
        for (int i = 2; i <= root; i++) {
            if (checkNumber % i == 0) {
                return false;
            }
        }
        return true;
    }

    @Override
    public void setThreadPool(ExecutorService threadPool) {
        // Do nothing

    }

}
